﻿using System.Linq;
using WinFormSQLServerLoginDemo.EF6;
using WinFormSQLServerLoginDemo.Entity;

namespace WinFormSQLServerLoginDemo.Services
{
    internal class UserService
    {
        public User Login(string username, string password)
        {
            using (MyDbContext db = new MyDbContext())
            {
                return db.Users
                    .Where(e => e.Username.Equals(username) && e.Password.Equals(password))
                    .FirstOrDefault();
            }
        }
    }
}
